package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("fos.txt");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入字符串");
        while (true) {
            String sst = scan.nextLine();
            if ("exit".equals(sst)) {
                break;
            }
            fos.write(sst.getBytes(StandardCharsets.UTF_8));
        }
        System.out.println("结束写入");
        fos.close();

    }
}
